package com.example.fund.updatestategy;

import java.util.LinkedList;
import java.util.List;

public class MixIndexStrategy extends AbstractUpdateStrategy
{

	private List<UpdateStrategy> indexStrategyLs = new LinkedList<UpdateStrategy>();;
	
	public MixIndexStrategy(String number) 
	{
		super(number);
		indexStrategyLs.add(new WY163AIndexStrategy(number));
		indexStrategyLs.add(new THSIndexStrategy(number));
		indexStrategyLs.add(new THSBKIndexStrategy(number));
	}

	@Override
	public void updateIndex()
	{
		if(indexStrategyLs==null)
		{
			return;
		}
		for(int i=0;i<indexStrategyLs.size();i++)
		{
			boolean isNeedUpdate = isNeedUpdate();
			if(!isNeedUpdate)
			{
				break;
			}
			UpdateStrategy indexStrategy = indexStrategyLs.get(i);
			indexStrategy.updateIndex();
		}
	}

}
